package com.woniu.zsd.order.config;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;

@Configuration
public class RabbitMQConfig {
    @Bean
    public Queue expiredQueue(){
        HashMap<String, Object> args = new HashMap<>();
        args.put("x-message-ttl", 60*30 * 1000); // 设置消息存活时间为30分钟
        args.put("x-dead-letter-exchange", "exchange1"); // 设置死信交换机
        args.put("x-dead-letter-routing-key", "timeout"); // 设置死信路由键
        return new Queue("site-expired-queue", true, false, false, args);
    }
}
